package com.ruoyi.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.system.domain.zbg.IndicatorData;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;

public interface IndicatorDataMapper extends BaseMapper<IndicatorData> {
    @Insert("<script>" +
            "INSERT INTO indicator_data (district, site_code, site_name, pue_value, power_supply_ratio, average_daily_electricity, equipment_load, electricity_price, year, month) " +
            "VALUES (#{indicatorData.district}, #{indicatorData.siteCode}, #{indicatorData.siteName}, #{indicatorData.pueValue}, #{indicatorData.powerSupplyRatio}, #{indicatorData.averageDailyElectricity}, #{indicatorData.equipmentLoad}, #{indicatorData.electricityPrice}, #{indicatorData.year}, #{indicatorData.month}) " +
            "ON DUPLICATE KEY UPDATE " +
            "site_name = VALUES(site_name), " +
            "pue_value = VALUES(pue_value), " +
            "power_supply_ratio = VALUES(power_supply_ratio), " +
            "average_daily_electricity = VALUES(average_daily_electricity), " +
            "equipment_load = VALUES(equipment_load), " +
            "electricity_price = VALUES(electricity_price)" +
            "</script>")
    int saveOrUpdate(@Param("indicatorData") IndicatorData indicatorData);
}